/**
 * @param {string} sentence
 * @return {string}
 */
export var toGoatLatin = function (sentence) {
  const words = sentence.split(' ')
  const vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
  const ans = []
  for (let i = 0; i < words.length; i++) {
    const word = words[i]
    const c = word[0]
    if (vowels.includes(c)) {
      ans.push(word + 'ma')
    } else {
      ans.push(word.slice(1) + c + 'ma')
    }
    ans[i] = ans[i].padEnd(ans[i].length + i + 1, 'a')
  }
  return ans.join(' ')
}
